package com.atguigu.springcloud.exception;

import com.atguigu.springcloud.enums.BaseExceptionCode;

/**
 * @Author lizhilong
 * @create 2020/5/2 14:15
 * @desc
 */
public class BaseException extends  RuntimeException{

    private static final long serialVersionUID = -3962157388406613297L;
    private String errorCode;
    private BaseExceptionCode baseErrorCode;

    public BaseException() {
    }

    public BaseException(String message) {
        super(message);
    }

    public BaseException(String errorCode, String message) {
        super(message);
        this.errorCode = errorCode;
    }

    public BaseException(String errorCode, String message, String errorTips) {
        super(message);
        this.errorCode = errorCode;
    }

    public BaseException(BaseExceptionCode baseErrorCode, String message) {
        super(message);
        this.baseErrorCode = baseErrorCode;
    }

    public BaseException(String message, Throwable cause) {
        super(message, cause);
    }

    public BaseException(BaseExceptionCode baseErrorCode) {
        this.baseErrorCode = baseErrorCode;
    }

    public BaseException(BaseExceptionCode baseErrorCode, String message, Throwable cause) {
        super(message, cause);
        this.baseErrorCode = baseErrorCode;
    }

    public BaseException(Throwable cause) {
        super(cause);
    }

    public BaseException(BaseExceptionCode baseErrorCode, Throwable cause) {
        super(cause);
        this.baseErrorCode = baseErrorCode;
    }


    public String getErrorCode() {
        return this.errorCode;
    }


    public BaseExceptionCode getBaseErrorCode() {
        return this.baseErrorCode;
    }

    public boolean hasFlashErrorCode() {
        return this.baseErrorCode != null;
    }

}
